package cn.basic.social.api.qwtalk.channel.internal.request;

import cn.basic.social.api.exception.ApiRuleException;
import cn.basic.social.api.CommonConstants;
import cn.basic.social.api.qwtalk.channel.internal.response.InternalGetcallbackipResponse;
import cn.basic.social.api.qwtalk.BaseQwRequest;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName InternalGetcallbackipRequest
 * @Description 获取企业微信回调IP段。企业微信在回调企业指定的URL时，是通过特定的IP发送出去的。如果企业需要做防火墙配置，那么可以通过这个接口获取到所有相关的IP段。
 * IP段有变更可能，当IP段变更时，新旧IP段会同时保留一段时间。建议企业每天定时拉取IP段，更新防火墙设置，避免因IP段变更导致网络不通。
 * @Author zlf
 * @Date 2023/8/28 17:08
 */
public class InternalGetcallbackipRequest extends BaseQwRequest<InternalGetcallbackipResponse> {

    private final String requestUrl = "https://qyapi.weixin.qq.com/cgi-bin/getcallbackip";
    private String topHttpMethod = CommonConstants.HTTP_METHOD_GET;

    public InternalGetcallbackipRequest() {
    }

    @Override
    public String getTopHttpMethod() {
        return this.topHttpMethod;
    }

    @Override
    public void setTopHttpMethod(String topHttpMethod) {
        this.topHttpMethod = topHttpMethod;
    }

    @Override
    public Map<String, String> getTextParams() {
        return new HashMap<>();
    }

    @Override
    public Class<InternalGetcallbackipResponse> getResponseClass() {
        return InternalGetcallbackipResponse.class;
    }

    @Override
    public void check() throws ApiRuleException {

    }

    @Override
    public String getTopContentType() {
        return null;
    }

    @Override
    public void setTopContentType(String topContentType) {

    }

    @Override
    public String getRequestUrl() {
        return this.requestUrl;
    }
}
